// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

import { LineEdit } from "std-widgets.slint";

export component TestCase inherits Window {
    in-out property <bool> condition: true;

    out property <string> value;

    if condition: VerticalLayout {
        if condition : HorizontalLayout {
            LineEdit {
                accepted => {
                    value = self.text;
                    condition = false;
                }
                placeholder-text: "Hello";
            }
            LineEdit {

            }

        }

    }

    if !condition: VerticalLayout {
        LineEdit {   }
        if !condition: FocusScope {
            focus-changed-event => {
                condition = true;
            }
        }
    }
}

/*
```rust
let instance = TestCase::new().unwrap();
slint_testing::send_keyboard_string_sequence(&instance, "\t");
slint_testing::send_keyboard_string_sequence(&instance, "hophop\n");
assert_eq!(instance.get_value(), "hophop");
assert_eq!(instance.get_condition(), false);
slint_testing::send_keyboard_string_sequence(&instance, "a\n\tdd\t");
assert_eq!(instance.get_condition(), true);
slint_testing::send_keyboard_string_sequence(&instance, "\tblop\n\t");
assert_eq!(instance.get_value(), "blop");
```

*/
